package com.wushi.lenovo.asia5b.app_ui.pay.view;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.mvp.utils.StringUtils;
import com.wushi.lenovo.asia5b.R;
import com.wushi.lenovo.asia5b.app_model.credit.bean.TopupInfoBean;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by zhangyuncai on 2019/2/21.
 */
public class PayPriceInfoView extends LinearLayout {
    @BindView(R.id.tv_pay_balance)
    TextView tv_pay_balance;//账户余额
    @BindView(R.id.tv_pay_payprice)
    TextView tv_pay_payprice;//账单总额
    @BindView(R.id.tv_pay_diffpayprice)
    TextView tv_pay_diffpayprice;//账单总额-账户余额

    public PayPriceInfoView(Context context) {
        super(context);
        init();
    }

    public PayPriceInfoView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public PayPriceInfoView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init() {
        View.inflate(getContext(), R.layout.view_paypriceinfo, this);
        ButterKnife.bind(this);

        initView();

        initEvent();
    }

    private void initEvent() {

    }

    private void initView() {

    }

    public void setTopupInfoBean(TopupInfoBean topupInfoBean) {
        tv_pay_balance.setText(StringUtils.formatNum2(topupInfoBean.getBalance_value() + ""));
        tv_pay_payprice.setText(StringUtils.formatNum2(topupInfoBean.getTotalAmount()));
        tv_pay_diffpayprice.setText(StringUtils.formatNum2(topupInfoBean.getDiffAmount() + ""));
    }
}
